<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class SystemModelRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            //
            'name' => 'required',
            'table_name' => 'required|alpha_dash',
            'description' => 'required',
        ];
    }

    public function messages()
    {
        $message = [
            'name.required' => '名称必须填写',
            'table_name.required' => '表名称必须填写',
            'table_name.alpha_dash' => '表名称格式不正确',
            'description.required' => '描述必须填写',
        ];
        return $message;
    }
}
